package com.shawn.integeration.business.studentmanager.controller;

import cn.hutool.core.date.DateUtil;
import com.shawn.integeration.business.studentmanager.model.Student;
import com.shawn.integeration.common.model.controller.BaseController;
import com.shawn.integeration.common.model.res.GenericResponse;
import org.springframework.web.bind.annotation.*;

/**
 * 学生管理控制层
 *
 * @author: shawn
 * @Date: 2023/12/28 13:52
 * @Version 1.0.0
 */
@RestController
@RequestMapping("/student")
public class StudentController extends BaseController {

    @PostMapping(value = "/add")
    public GenericResponse<Student> add(@RequestBody Student student) {
        return GenericResponse.success(student);
    }


    @GetMapping(value = "/{studentId}")
    public GenericResponse<Student> getInfo(@PathVariable("studentId") Long studentId) {
       // 模拟查询返回数据
        Student student = new Student();
        student.setStudentId(studentId);
        student.setStudentName("shawn");
        student.setStudentAge(20);
        student.setStudentSex("0");
        student.setStudentHobby("打篮球");
        student.setStudentStatus("0");
        student.setStudentBirthday(DateUtil.parse("1995-10-01","yyyy-MM-dd"));
        return GenericResponse.success(student);
    }
}
